
public class FilePath {
    public static void main(String[] args) {
        String s = "C:/Program Files/Java/jdk1.8.0_91/bin/java.exe";
        //1. 路径 C:/Program Files/Java/jdk1.8.0_91/bin/
        int lastIndex = s.lastIndexOf('/');
        String filePath = s.substring(0,lastIndex + 1);

        //2. 文件名  java
        int pointIndex = s.indexOf('.');
        String fileName = s.substring(lastIndex + 1,pointIndex);

        //3. 扩展名  exe
        String fileExtends = s.substring(pointIndex + 1);

        //4.输出结果
        System.out.println("源文件为：" + s);
        System.out.println("路径为：" + filePath);
        System.out.println("文件名为：" + fileName);
        System.out.println("扩展名为：" + fileExtends);



    }
}
